package com.fjwt.gz.mgr.ctrl.equity;

import cn.hutool.json.JSONUtil;
import com.fjwt.gz.core.model.ApiRes;
import com.fjwt.gz.db.entity.AgentEquityEntity;
import com.fjwt.gz.mgr.ctrl.CommonCtrl;
import com.fjwt.gz.service.impl.AgentEquityService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/api/equity")
public class EquityMultiplierController extends CommonCtrl {

    @Autowired
    private AgentEquityService agentEquityService;


    /**
     * 查询权益栏目名称
     */
    @PostMapping("/selectEquityName")
    public ApiRes selectEquityName() {
        Integer pid = getValInteger("pid");
        String agentNo = getValString("agentNo");
        log.info("pc端权益查询，请求地址：/api/equity/selectEquityName，权益levelEquityPId：{}, agentNo:{}", pid, agentNo);
        List<AgentEquityEntity> list = agentEquityService.selectEquityNameList(pid, agentNo);
        log.info("pc端权益查询，请求地址：/api/equity/selectEquityName，返回结果：{}", JSONUtil.toJsonStr(list));
        return ApiRes.ok(list);
    }
}
